<div style="position:fixed;width:195px;margin:10px 0 0;" id="category" class="category panel-group">
    {% for category in categories %}
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title">
                    <a style="display:block;text-align:left;" href="#category{{ loop.index }}"
                       data-toggle="collapse"
                       data-parent="#category">{{ category.name }}
                    </a>
                </h4>
            </div>
            <div id="category{{ loop.index }}"
                 class="panel-collapse collapse{% if current_category is not none %}{% if current_category.up.id==category.id %} in{% endif %}{% endif %}">
                <div class="panel-body">
                    <ul>
                        {% for down in category.down.all() %}
                            <li>
                                <a href="{{ url('book:category',args=(down.id,1)) }}">
                                    {{ down.name }}
                                </a>
                            </li>
                        {% endfor %}
                    </ul>
                </div>
            </div>
        </div>
    {% endfor %}
</div>
